<!--{template Header.htm}-->
<style type="text/css">
    #search {
        width: 70%;
    }
</style>
<header class="mui-bar mui-bar-nav">
    <h1 class="mui-title">{$title}</h1>
</header>
<div class="mui-content">
    <div class="mui-content-padded center">
        <input id="search" type="text" name="keyword" placeholder="请输入关键词" onClick="this.select()"/>
        <input type="button" value="搜索" onclick="searchArticle()"/>
    </div>
    <!--{eval $count = isset($articles) ? count($articles) : 0;}-->
    <!--{if $count < 1}-->
    <br/>

    <p class="center hint">暂时还没有文章</p>
    <!--{else}-->
    <ul class="mui-table-view content">
        <!--{eval $page_size = 7;}-->
        <!--{eval $page_index = isset($_GET['page']) ? intval($_GET['page']) : 1;}-->
        <!--{eval $pager = new Pager($count, $page_index, $page_size);}-->
        <!--{for $i=$pager->getStartNum(); $i<=$pager->getEndNum(); $i++}-->
        <li class="mui-table-view-cell mui-media">
            <div class="mui-media-body">
                <!--{$i}-->、
                <a href="{$base_url}/index.php?c=Article&a=detail&id={$articles[$i-1]['id']}"
                   id="article_{$articles[$i-1]['id']}">
                    <!--{eval echo Ubb::decode($articles[$i-1]['title']);}-->
                </a>

                <p class='mui-ellipsis'>
                    <!--{eval echo date('m月d日 H:i',$articles[$i-1]['timeline']);}-->
                </p>
            </div>
        </li>
        <!--{/for}-->
    </ul>
    <!--{if $count > $page_size}-->
    <ul class="mui-pager">
        <li>
            <!--{$pager->getPrevPage()}-->
        </li>
        <li>
            <!--{$pager->getNextPage()}-->
        </li>
        <li>
            <span><!--{$page_index}-->/<!--{$pager->getPageNum()}--></span>
        </li>
    </ul>
    <!--{/if}-->
    <!--{/if}-->
</div>
<script type="text/javascript">
    function searchArticle() {
        var keyword = jQuery.trim(jQuery("#search").val());
        if (keyword == "") {
            alert("请输入要搜索的关键词！");
            return false;
        } else {
            window.location = "{$base_url}/index.php?c=Article&a=search&keyword=" + encodeURIComponent(keyword);
            return false;
        }
    }
</script>
<!--{template Footer.htm}-->